package com.powerrich.eureka.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 黄雨
 * @title: UserController
 * @projectName demo
 * @description: TODO
 * @date 2019-04-1114:35
 */
@RestController
public class UserController {

    @Value("${user.userName}")
    private String userName;
    @Value("${user.from}")
    private String from;

    /**
     * 假如这个客户端要提供一个getUser的方法
     * @return
     */
    @GetMapping(value = "/getUser")
    @ResponseBody
    public Map<String,Object> getUser(@RequestParam Integer id){
        Map<String,Object> data = new HashMap<>();
        data.put("id",id);
        data.put("userName",userName);
        data.put("from",from);
        return data;
    }
}
